using System;
using System.IO;
using System.Text;
using BlogEngine.Core.DataStore;
using System.Xml;
using System.Xml.Serialization;
using System.Web.Hosting;
using AzureProvider.SoupMethods;

namespace BlogEngine.Core.Providers
{
  /// <summary>
  /// A storage provider for BlogEngine that uses XML files.
  /// <remarks>
  /// To build another provider, you can just copy and modify
  /// this one. Then add it to the web.config's BlogEngine section.
  /// </remarks>
  /// </summary>
    public partial class AzureBlogProvider : BlogProvider
  {

        DataStoreSettingsMethods DataStoreSettingsMethods = new DataStoreSettingsMethods();

      /// <summary>
      /// Load user data from DataStore
      /// </summary>
      /// <param name="exType">type of info</param>
      /// <param name="exId">id of info</param>
      /// <returns>stream of detail data</returns>
      public override object LoadFromDataStore(ExtensionType exType, string exId)
      {
          return DataStoreSettingsMethods.LoadFromDataStore(exType, exId);
      }

      /// <summary>
      /// Save to DataStore
      /// </summary>
      /// <param name="exType">type of info</param>
      /// <param name="exId">id of info</param>
      /// <param name="settings">data of info</param>
      public override void SaveToDataStore(ExtensionType exType, string exId, object settings)
      {
          if (settings == null)
              throw new ArgumentNullException("settings");

          DataStoreSettingsMethods.SaveToDataStore(exType, exId, settings);
      }

      /// <summary>
      /// Deletes an item from the dataStore
      /// </summary>
      /// <param name="exType">type of item</param>
      /// <param name="exId">id of item</param>
      public override void RemoveFromDataStore(ExtensionType exType, string exId)
      {
         DataStoreSettingsMethods.RemoveFromDataStore(exType, exId);
      }

      ///// <summary>
      ///// Storage location on web server
      ///// </summary>
      ///// <returns>string with virtual path to storage</returns>
      //public override string StorageLocation()
      //{
      //    if (String.IsNullOrEmpty(System.Web.Configuration.WebConfigurationManager.AppSettings["StorageLocation"]))
      //        return @"~/app_data/";
      //    return System.Web.Configuration.WebConfigurationManager.AppSettings["StorageLocation"];
      //}

  }
}

